home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Add-Ons / MicroPhone / Open Mike™ / Open Mike™ 008 / Mike's Folder / Hacker's Hangout < prev    next >
Encoding:
Text File  |  1993-08-01  |  4.6 KB  |  48 lines  |  [TEXT/ttxt]

  1. Hacker's Hangout
  2. ================
  3. Copyright © 1993 by Celestin Company
  4. All rights reserved.
  5.  
  6. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without permission in writing from the publisher. However, you are permitted to make copies of this work, printed or otherwise, as long as said copies are for your personal use only.
  7.  
  8. Introduction
  9. ------------
  10. This month's definition of hack: you might want to applaud for this way to figure out your baud. Have you ever wanted to figure out your baud rate without going to the Communications Settings dialog? Have you ever wanted a quick way of changing it? ComSet puts up a palette that shows you your current baud rate and other communication settings. Since it is a module, you can use it in any settings document.
  11.  
  12. Instructions - Put the module called 'ComSet' in your Module Folder, which is in the same location as the MicroPhone application. If you do not have a Module Folder, create one. Open any MicroPhone settings document. Create the following script:
  13.  
  14.   Do Script "'Main','ComSet'"
  15.  
  16. That's it.
  17.  
  18. Theory
  19. ------
  20. So, what's behind this hack? Let's take a quick look at the scripts in ComSet. Here are the scripts in the ComSet module:
  21.  
  22. ComSet
  23. ComSet Handler
  24. ComSet Handler_baud
  25. ComSet Handler_connection
  26. ComSet Handler_read
  27. Main
  28.  
  29. Main - this script simply calls the script ComSet. It is used to provide a single entry point into the module. This way, you don't have to know the name of a particular script. Just call the main script in any of the modules that have been provided with Open Mike and they will do the right thing.
  30.  
  31. ComSet - this script displays the actual dialog that includes two popups, one for baud rate and one for other communication settings. First, it checks to make sure that the dialog is not already up (nothing worse than having multiple instances of the same dialog!). If the dialog is not up, it sets it up and displays it. MPDialogerPro displays the dialog as a float, so it will always appear above all other dialogs and the terminal window.
  32.  
  33. ComSet Handler - this is the hit handler for the ComSet dialog. Whenever the user does anything with the ComSet dialog, this script is called and acts like a dispatcher, calling other scripts as necessary. The first thing the script does is check to see if the dialog is being initialized. MPDialogerPro always passes an itemHit of '0' when it first displays a dialog. This allows the hit handler to perform additional initialization of the dialog. If this hit is received, the script performs some additional initialization and checks a preference file to see where the dialog was last located, so it can put it in the same location this time. The last thing it does during initialization is call the 'ComSet Handler_read' script to determine the current communication settings that it should display. If itemHit is '1', the user did something with the baud rate popup, so the 'ComSet Handler_baud' script is called. If itemHit is '2', the user did something with the connection popup and the 'ComSet Handler_connection' script is called. If the itemHit is '-1', the user clicked in the close box of the dialog, so the script writes the current location of the dialog to the preference file and gets rid of the dialog, performing any necessary housekeeping in the process.
  34.  
  35. ComSet Handler_baud - this script determines the baud rate the user wants to set by reading the state of the popup. It then sets the appropriate baud rate.
  36.  
  37. ComSet Handler_connection - this script determines the connection settings (data bits and parity) the user selected and sets the settings appropriately. Since there are really only two different valid settings (8 N 1 or 7 E 1), these are the only two that are allowed in the popup. Makes things a lot easier and doesn't require three popups as opposed to one.
  38.  
  39. ComSet Handler_read - this script determines the current communication settings and changes the popups in the dialog to correspond to them.
  40.  
  41. Where to go from here
  42. ---------------------
  43. What other settings would be nifty to set from a palette such as this? How about terminal settings? How about a palette that tells you the current state of capturing and printing? Hmm, that might be something for a future issue of Open Mike!
  44.  
  45. Important Note
  46. --------------
  47. Hacks are not guaranteed to work, although there is no reason why they shouldn't work. Every care has been taken to make sure that they work on the hacker's machine, but they may do other things on your machine. Of course, if you encounter problems, you may feel free to tweak the hack to run on your machine.
  48.